

package at.fhj.itm.metadata.impl.postgres;

import at.fhj.itm.metadata.MetadataItem;
import at.fhj.itm.metadata.TriggerFlag;
import at.fhj.itm.metadata.impl.AbstractTrigger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;


/**
 *
 * @author Seuchter
 */
public class PostgresTrigger extends AbstractTrigger {

    private long oid;
    private PostgresProcedure pgProc;



    public PostgresTrigger(final String name, final EnumSet<TriggerFlag> flags, final PostgresProcedure pgProc, final long oid)
    {
        super(name, flags);
        this.pgProc = pgProc;
        this.oid = oid;
    }

    public long getOid()
    {
        return oid;
    }

    public PostgresProcedure getProcedure()
    {
        return pgProc;
    }

    public List<? extends MetadataItem> getChildren()
    {
        List<PostgresProcedure> procs = new ArrayList<PostgresProcedure>();
        procs.add(pgProc);
        return procs;
    }

    public PostgresTrigger copy(){
        
        return new PostgresTrigger(getName(), getEnumFlags().clone(), getProcedure().copy(), -1);
    }
}
